package orm

import (
	"database/sql"
	"fmt"
	_ "github.com/jinzhu/gorm/dialects/mysql"
)

type BasicsOrmFunc struct {
	db *sql.DB
}

func (b BasicsOrmFunc) Query(sql string, params []interface{})*sql.Rows{
	panic("implement me")
}

func (b BasicsOrmFunc) Insert(sql string, params interface{}) int {
	panic("implement me")
}

func (b BasicsOrmFunc) Update(sql string, params interface{}) bool {
	panic("implement me")
}

func (b BasicsOrmFunc) Delete(sql string, params interface{}) bool {
	panic("implement me")
}

func newBasicOrmFunc()OrmFunc{
	return func(userName string, passWord string, url string, database string) OrmInfuraInter {
		db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%scharset=utf8&parseTime=True&loc=Local&timeout=10s",userName,passWord,url,database))
		if err!=nil{
			panic(err)
		}
		return BasicsOrmFunc{db: db}
	}
}